﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DiPlaner.Profile
{/*

    public class BotProfile : INotifyPropertyChanged, IDisposable
    {
        public ListTemplate LinePanel { get; set; }
        public BotData BotInstance { get; set; }
        public D3Data D3Instance { get { return BotInstance.d3Data; } }
        public DBData DBInstance { get { return BotInstance.dBData; } }

        public int Index;

        public struct BotData
        {
            public D3Data d3Data;
            public DBData dBData;
        }

        public BotProfile(int index)
        {
            Index = index;
            BotInstance = new BotData();
            LinePanel = new ListTemplate(index);

            LinePanel.line_btn_del.Click += delegate { Dispose(); };

            LinePanel.line_btn_start.Click += delegate { };

            LinePanel.line_btn_stop.Click += delegate { };

            LinePanel.line_btn_wiz.Click += delegate { SettingsWizzard(); };

            LinePanel.line_chb_enable.CheckedChanged += delegate { };

            LinePanel.line_chb_minimize.CheckedChanged += delegate
                {
                    if (LinePanel.line_chb_minimize.Checked)
                        Program._moveWindow(Index);
                    else
                        Program._restoreWindow(Index);
                };
        }
        

        #region Control functions

        public void SettingsWizzard()
        {
            using (var bsf = new BotSetupForm()) {
                bsf.CurentBot = Index > 0 ? BotInstance : new BotData();
                bsf.ShowDialog();
                if (bsf.DialogResult == DialogResult.OK) {
                    BotInstance = bsf.CurentBot;
                }

                LinePanel.line_lb_name.Text = !String.IsNullOrEmpty(D3Instance.Bot.bnet) && D3Instance.Bot.bnet.IndexOf("@", StringComparison.Ordinal) > 0 ?
                        D3Instance.Bot.bnet.Substring(0, D3Instance.Bot.bnet.IndexOf("@", StringComparison.Ordinal)) : "";
            }
        }

        public void Minimize(Point size) 
        {

        }

        public void Maximize() 
        {

        }
        #endregion

        public void Dispose()
        {
            LinePanel.Dispose();
            LinePanel = null;
            NotifyChangings(String.Format("[{0:00}] Delete line", Index));
        }

        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyChangings(string propertyName) 
        {
            var handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyName));
        }
    }//*/
}
